import QtQuick 2.0
import QtQuick.Controls 1.2

Rectangle{
    width: 320; height: 480
    color: "grey"

    focus: true
    Keys.enabled: true
    Keys.onEscapePressed: Qt.quit()
    Keys.forwardTo: [moveText, likeQt]

    Text {
        id: moveText
        text: qsTr("Moving Text")
        width: 200; height: 30
        x: 20; y: 20
        color: "blue"
        font { bold: true; pixelSize: 24}
        Keys.enabled: true
        Keys.onPressed: {
            switch(event.key){
            case Qt.Key_Left:
                x -= 10;
                break;
            case Qt.Key_Right:
                x += 10;
                break;
            case Qt.Key_Up:
                y -= 10;
                break;
            case Qt.Key_Down:
                y += 10;
                break;
            //case Qt.Key_Space:
            //    x = 20; y = 20;
             //   break;
            default:
                return
            }
            event.accepted = true
        }
    }

    CheckBox{
        id: likeQt
        text: "Like Qt Quick"
        anchors.left : parent.left
        anchors.leftMargin: 10
        anchors.bottom: parent.bottom
        anchors.bottomMargin: 10
    }
}
